<?php
/***************************************************************************
 *   copyright : (C) 2009 Udrea Cristian
 *   site : http://code.google.com/p/testauction-php
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as 
 *   published by the Free Software Foundation; either version 2 of the
 *   License, or (at your option) any later version. Although none of the
 *   code may be sold. If you have been sold this script, get a refund.
 ***************************************************************************/
$contents="";
$template->setCurrentBlock("table_page");
/**
 * Forgot Password form has been submitted and no errors
 * were found with the form (the username is in the database)
 */
if(isset($_SESSION['forgotpass'])){
   /**
    * New password was generated for user and sent to user's
    * email address.
    */
   if($_SESSION['forgotpass']){
      $contents .= "<p>O noua parola a fost creata si trimisa la ".
          "adresa de email asociata contului tau.</p>";
   }
   /**
    * Email could not be sent, therefore password was not
    * edited in the database.
    */
   else{
      $contents .= "<p>Noua parola nu a putut fi trimisa la ".
          "adresa de email si prin urmare, parola nu a fost schimbata. ";
   }
       
   unset($_SESSION['forgotpass']);
}
else{
/**
 * Forgot password form is displayed, if an error is found
 * it is displayed.
 */
	$contents .= "<h3>Am uitat parola</h3><br />".
	"Datorita sistemului de securitate, vechea parola nu poate fi recuperata.<br /><br />".
	"In schimb, o noua parola va fi creata si trimisa catre adresa de email<br />".
	"asociata contului tau impreuna cu instructiunile de schimbare a parolei.<br />". 
	"Tot ceea ce trebuie sa faci este sa introduci numele de utilizator al contului tau.<br /><br />".$form->error("user").
	"<form action=\"process.php\" method=\"post\"><div>".
	"<b style=\"color: black;\">Nume de utilizator &nbsp;</b> <input type=\"text\" name=\"user\" maxlength=\"30\" value=\"".$form->value("user")."\" style=\"border: 1px solid\"/>".
	"<input type=\"hidden\" name=\"subforgot\" value=\"1\"/>".
	"<button type=\"submit\" class=\"lime-button\">Trimite</button></div></form>";
 }
$template->setVariable(TABLEPAGECONTENT, $contents);
$template->parseCurrentBlock();
?>
